﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AppBrowser
{
    public partial class frmAddAppVersion : Form
    {
        private AppVersion _appVersion;
        public AppVersion AppVersionData
        {
            get { return _appVersion; }
            set { _appVersion = value; }
        }

        public frmAddAppVersion()
        {
            InitializeComponent();
        }

        private void frmAddAppVersion_Load(object sender, EventArgs e)
        {
            if (_appVersion != null)
            {
                // edit mode
                FillFormValues();
            }
            else
            {
                // add mode
                _appVersion = new AppVersion();
            }
        }

        private void FillFormValues()
        {
            txtVersionNumber.Text = _appVersion.VersionNumber;
            txtDownloadUrl.Text = _appVersion.DownloadUrl;
            txtFilename.Text = _appVersion.FileName;
            txtType.Text = _appVersion.VersionType;
            txtDescription.Text = _appVersion.VersionDescription;
            
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            _appVersion.VersionNumber = txtVersionNumber.Text;
            _appVersion.VersionType = txtType.Text;
            _appVersion.DownloadUrl = txtDownloadUrl.Text;
            _appVersion.FileName = txtFilename.Text;
            _appVersion.VersionDescription = txtDescription.Text;
            _appVersion.ReleaseDate = dateTimePicker1.ToString();
        }

    }
}
